package com.ruoyi.community.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.community.domain.vo.HouseHistoryVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.community.mapper.HouseHistoryMapper;
import com.ruoyi.community.domain.HouseHistory;
import com.ruoyi.community.service.IHouseHistoryService;

/**
 * 房屋记录Service业务层处理
 *
 * @author lj
 * @date 2022-02-22
 */
@Service
public class HouseHistoryServiceImpl implements IHouseHistoryService
{
    @Autowired
    private HouseHistoryMapper houseHistoryMapper;

    /**
     * 查询房屋记录
     *
     * @param id 房屋记录主键
     * @return 房屋记录
     */
    @Override
    public HouseHistory selectHouseHistoryById(Long id)
    {
        return houseHistoryMapper.selectHouseHistoryById(id);
    }

    /**
     * 查询房屋记录列表
     *
     * @param houseHistory 房屋记录
     * @return 房屋记录
     */
    @Override
    public List<HouseHistory> selectHouseHistoryList(HouseHistory houseHistory)
    {
        return houseHistoryMapper.selectHouseHistoryList(houseHistory);
    }

    @Override
    public List<HouseHistoryVo> selectHouseHistoryLists(HouseHistoryVo houseHistory) {
        return houseHistoryMapper.selectHouseHistoryLists(houseHistory);
    }

    /**
     * 新增房屋记录
     *
     * @param houseHistory 房屋记录
     * @return 结果
     */
    @Override
    public int insertHouseHistory(HouseHistory houseHistory)
    {
        houseHistory.setCreatTime(DateUtils.getNowDate());
        houseHistory.setUpdateTime(DateUtils.getNowDate());
        houseHistory.setDelFlag(0);
        return houseHistoryMapper.insertHouseHistory(houseHistory);
    }

    /**
     * 修改房屋记录
     *
     * @param houseHistory 房屋记录
     * @return 结果
     */
    @Override
    public int updateHouseHistory(HouseHistory houseHistory)
    {
        houseHistory.setUpdateTime(DateUtils.getNowDate());
        return houseHistoryMapper.updateHouseHistory(houseHistory);
    }

    /**
     * 批量删除房屋记录
     *
     * @param ids 需要删除的房屋记录主键
     * @return 结果
     */
    @Override
    public int deleteHouseHistoryByIds(Long[] ids)
    {
        return houseHistoryMapper.deleteHouseHistoryByIds(ids);
    }

    /**
     * 删除房屋记录信息
     *
     * @param id 房屋记录主键
     * @return 结果
     */
    @Override
    public int deleteHouseHistoryById(Long id)
    {
        return houseHistoryMapper.deleteHouseHistoryById(id);
    }

    @Override
    public int updateHouseHistoryByIds(Long[] ids) {
        return houseHistoryMapper.updateHouseHistoryByIds(ids);
    }
}
